Asssumes you have aready run: - config - workflow_deepseaNiN_Start
You now have the objects needed to explore the dataset and find the best way to apply biogeographic splits. This is a pre-step before running the workflow again on the split dataset to explore possible LKMs.
This requires exploring the dataset to theorise the best ways to split the data with: - environmental biplots/colourings
then applying the splits.
library(plotly)
library(readxl)
should include all env Vars and otus to explore, and make species richness variable
#add species data and sp richness variable
env_sub_meta1<-cbind(env,otu_6)
env_sub_meta1$spRich<-rowSums(otu_6[,-c(1:which(colnames(otu_6)=="Zoanthidae"))]!=0)
#rename X
env_sub_meta1$X <- env$X.y
env_sub_meta1 <-env_sub_meta1 %>% select (-c(X.y))
#add samplID
env_sub_meta1$SampID<-envSel$SampID
Note that biotopes were last assigned in march 2022 and therefore there are some addional samples that have not yet got a biotope assigned. These should just be NAs
biotopeInfo<-read_xlsx(file.path(dataPath, "inputs/MAREANO_provisional_biotope_classification_0322.xlsx"), sheet=1) %>%
select(-c(x_coordinate_UTM33N, y_coordinate_UTM33N))
env_sub_meta<-left_join(env_sub_meta1,biotopeInfo)
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
summary(env_sub_meta)
Tmean_Robinson salt_max Smax_Robinson swDensRob_avs BO22_icecoverltmax_ss BO22_icecovermean_ss
Min. :-1.067 Min. :34.81 Min. :34.43 Min. :1027 Min. :0.00000 Min. :0.000000
1st Qu.: 4.334 1st Qu.:34.98 1st Qu.:35.01 1st Qu.:1028 1st Qu.:0.00000 1st Qu.:0.000000
Median : 6.483 Median :35.13 Median :35.13 Median :1029 Median :0.00000 Median :0.000000
Mean : 5.732 Mean :35.11 Mean :35.12 Mean :1029 Mean :0.02378 Mean :0.007361
3rd Qu.: 7.285 3rd Qu.:35.19 3rd Qu.:35.30 3rd Qu.:1029 3rd Qu.:0.00000 3rd Qu.:0.000000
Max. : 8.447 Max. :35.82 Max. :35.42 Max. :1032 Max. :0.92838 Max. :0.409033
BO22_dissoxmean_bdmean BO22_ppltmin_ss X.y Y spd_std CSpdsd_Robinson
Min. :282.5 Min. :0.000e+00 Min. :-107939 Min. :6944134 Min. :0.02103 Min. :8.460e-06
1st Qu.:286.3 1st Qu.:0.000e+00 1st Qu.: 167561 1st Qu.:7315434 1st Qu.:0.05734 1st Qu.:3.822e-03
Median :293.8 Median :7.007e-06 Median : 495261 Median :7794534 Median :0.06821 Median :7.376e-03
Mean :299.3 Mean :1.152e-04 Mean : 499401 Mean :7710165 Mean :0.07648 Mean :9.172e-03
3rd Qu.:306.4 3rd Qu.:6.220e-05 3rd Qu.: 746161 3rd Qu.:8036434 3rd Qu.:0.09040 3rd Qu.:1.296e-02
Max. :372.2 Max. :1.067e-03 Max. :1162261 Max. :8949734 Max. :0.18145 Max. :5.305e-02
mud gravel BO22_silicateltmax_bdmean bathy gnmds1 gnmds2
Min. : 0.00 Min. : 0.00 Min. :4.585 Min. :-858.93 Min. :-1.9714 Min. :-3.4880
1st Qu.: 7.00 1st Qu.: 1.50 1st Qu.:5.905 1st Qu.:-362.36 1st Qu.:-0.3490 1st Qu.:-0.3604
Median :24.00 Median :18.00 Median :6.271 Median :-272.37 Median :-0.1435 Median :-0.1441
Mean :26.83 Mean :21.53 Mean :6.368 Mean :-306.32 Mean : 0.0000 Mean : 0.0000
3rd Qu.:35.00 3rd Qu.:35.00 3rd Qu.:6.581 3rd Qu.:-200.08 3rd Qu.: 0.3031 3rd Qu.: 0.3296
Max. :96.00 Max. :65.00 Max. :9.565 Max. : -38.47 Max. : 5.2198 Max. : 2.2982
X
Min. :-107939
1st Qu.: 167561
Median : 495261
Mean : 499401
3rd Qu.: 746161
Max. :1162261
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = bathy)) +
theme_classic() +
geom_point(aes(colour = gnmds1),
size = 1) +
scale_colour_gradientn(limits = c(-2, 2.5),
colors=c('red','yellow','green'))+
ggtitle("Temp (mean Robinson) vs Bathy - coloured by gnmds r6 ax1 - grey 2.5-5")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensbathy_v_temp_nmds1.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = bathy)) +
theme_classic() +
geom_point(aes(colour = Smax_Robinson),
size = 1) +
scale_colour_gradientn(limits = c(34.43, 35.43),
colors=c('green','yellow','blue'))+
ggtitle("Temp (mean Robinson) vs Bathy - coloured by salinity")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensbathy_v_temp_salinityMax.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = bathy)) +
theme_classic() +
geom_point(aes(colour = X.y),
size = 1) +
scale_colour_gradientn(limits = c(-107939, 1162261),
colors=c('red','yellow','blue'))+
ggtitle("Temp (mean Robinson) vs Bathy - coloured by longitude")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensbathy_v_temp_longitude.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = bathy)) +
theme_classic() +
geom_point(aes(colour = Y),
size = 1) +
scale_colour_gradientn(limits = c(6944134, 8949734),
colors=c('red','yellow','blue'))+
ggtitle("Temp (mean Robinson) vs Bathy - coloured by latitude")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensbathy_v_temp_latitude.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = bathy)) +
theme_classic() +
geom_point(aes(colour = BO22_icecoverltmax_ss),
size = 1) +
scale_colour_gradientn(limits = c(0,0.93),
colors=c('grey','turquoise','blue'))+
ggtitle("Temp (mean Robinson) vs Bathy - coloured by ice cover LT max")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensbathy_v_temp_iceCovLTmax.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Smax_Robinson,
y = bathy)) +
theme_classic() +
geom_point(aes(colour = Tmean_Robinson),
size = 1) +
scale_colour_gradientn(limits = c(-1.1, 8.5),
colors=c('red','yellow','green'))+
ggtitle("Salinity (max Robinson) vs Bathy - coloured by av Temp (R)")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensbathy_v_salMax_temp.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Smax_Robinson,
y = Tmean_Robinson)) +
theme_classic() +
geom_point(aes(colour = gnmds1),
size = 1) +
scale_colour_gradientn(limits = c(-2, 2.5),
colors=c('red','yellow','green'))+
ggtitle("Temp (mean Robinson) vs Salinity (max R) - coloured by gnmds r6 ax 1 - grey 2.5-5")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDenstempRmean_v_salinityRmax_nmds1.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Smax_Robinson,
y = Tmean_Robinson)) +
theme_classic() +
geom_point(aes(colour = BO22_dissoxmean_bdmean),
size = 1) +
scale_colour_gradientn(limits = c(282.5, 372.2),
colors=c('red','yellow','green'))+
ggtitle("Temp (mean Robinson) vs Salinity (max R) - coloured by dissolved oxygen")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDenstempRmean_v_salinityRmax_disooxmean.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Smax_Robinson,
y = Tmean_Robinson)) +
theme_classic() +
geom_point(aes(colour = BO22_icecoverltmax_ss),
size = 1) +
scale_colour_gradientn(limits = c(0,0.93),
colors=c('blue','green','red'))+
ggtitle("Temp (AvR) v Salinity (maxR) - coloured by ice cover LT max")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDens_TempAvSalMax_iceCoveLTmax.png"),
device = "png",
dpi=800 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = X,
y = Y)) +
theme_classic() +
geom_point(aes(colour = Tmean_Robinson),
size = 1) +
scale_colour_gradientn(limits = c(-1.1, 8.5),
colors=c('blue','green','red'))+
ggtitle("Geography (X v Y) - coloured by mean temp")
ggplotly(tb_ax1)
NA
ggsave(filename = file.path(dataPath,"outputs/LoDens_X_v_Y_tmeanR.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = X.y,
y = Y)) +
theme_classic() +
geom_point(aes(colour = swDensRob_avs),
size = 1) +
scale_colour_gradientn(limits = c(1027, 1032),
colors=c('blue','green','red'))+
ggtitle("Geography (X v Y) - coloured by water density")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDens_X_v_Y_swDenRobavs.png"),
device = "png",
dpi=800 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = X.y,
y = Y)) +
theme_classic() +
geom_point(aes(colour = BO22_dissoxmean_bdmean),
size = 1) +
scale_colour_gradientn(limits = c(282,373),
colors=c('blue','green','red'))+
ggtitle("Geography (X v Y) - coloured by dissovled oxygen")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDens_X_v_Y_dissox.png"),
device = "png",
dpi=800 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = X.y,
y = Y)) +
theme_classic() +
geom_point(aes(colour = BO22_icecoverltmax_ss),
size = 1) +
scale_colour_gradientn(limits = c(0,0.93),
colors=c('blue','green','red'))+
ggtitle("Geography (X v Y) - coloured by ice cover LT max")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDens_X_v_Y_iceCoveLTmax.png"),
device = "png",
dpi=800 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = BO22_dissoxmean_bdmean)) +
theme_classic() +
geom_point(aes(colour = gnmds1),
size = 1) +
scale_colour_gradientn(limits = c(-2, 2.5),
colors=c('red','yellow','green'))+
ggtitle("Temp (mean Robinson) v disox mean - coloured by gnmds ax 1 - grey 2.5-5")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDens_TmeanR_v_dissoxltmin_gnmds1.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
tb_ax1<- ggplot(data = env_sub_meta,
aes(x = Tmean_Robinson,
y = BO22_dissoxmean_bdmean)) +
theme_classic() +
geom_point(aes(colour = bathy),
size = 1) +
scale_colour_gradientn(limits = c(-860, -30),
colors=c('red','yellow','green'))+
ggtitle("Temp (mean Robinson) v disox mean - coloured by bathymetry")
tb_ax1
ggsave(filename = file.path(dataPath,"outputs/LoDensTmeanR_v_dissoxltmin_bathy.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
dis_split <- ggplot(data = env,
aes(x = X.y,
y = Y)) +
theme_classic() +
geom_point(aes(colour = MLDmean_bathy),
size = 1) +
scale_colour_manual(values=cbPalette)+
# scale_colour_brewer(palette = "Set3") +
ggtitle("Easting vs Northing - coloured by Mixed layer depth proximity")
dis_split
ggsave(filename = file.path(dataPath,"outputs/LoDens_XvY_MLDmeanBathy.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
env_sub_meta$ax1cat<-cut(env_sub_meta$gnmds1,
breaks=c(-3.2,-3,-2,-1,0,1,2,3,3.46))
env_sub_meta$ax2cat<-cut(env_sub_meta$gnmds2,
breaks=c(-1.9,-1,0,1,2,3,4,4.9))
dis_split <- ggplot(data = env_sub_meta,
aes(x = X.y,
y = Y)) +
theme_classic() +
geom_point(aes(colour = ax1cat),
size = 1) +
# scale_colour_manual(values=cbPalette) +# non-ordered colourblind pallette
scale_colour_brewer(palette = "Spectral") + # ordered colourblind pallette
ggtitle("Easting vs Northing - coloured by gnmds axis 1 HC units")
dis_split
ggsave(filename = file.path(dataPath,"outputs/LoDens_XvY_ax1cat.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
dis_split <- ggplot(data = env_sub_meta,
aes(x = X.y,
y = Y)) +
theme_classic() +
geom_point(aes(colour = ax2cat),
size = 1) +
# scale_colour_manual(values=cbPalette) +# non-ordered colourblind pallette
scale_colour_brewer(palette = "Spectral") + # ordered colourblind pallette
ggtitle("Easting vs Northing - coloured by gnmds axis 2 HC units")
dis_split
ggsave(filename = file.path(dataPath,"outputs/LoDens_XvY_ax2cat.png"),
device = "png",
dpi=300 )
Saving 7 x 7 in image
EDIT AREA FIRST!
save.image("I:/Scripts/deepseaNiN/Renv_deepseaNiN_LoDens.RData") # edit area first
NOW CLEAR ENVIRONMENT BEFORE RUNNING FOR NEW AREA